package com.betty.cscams.common.page;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 分页请求
 */
public class PageRequest {
	/**
	 * 当前页码
	 */
	private int pageNum = 1;
	/**
	 * 每页数量
	 */
	private int pageSize = 10;
	/**
	 * 查询参数
	 */
//	private Map<String, Object> params = new HashMap<>();
	private List<Map<String, Object>> params = new ArrayList<Map<String, Object>>();
	
	public int getPageNum() {
		return pageNum;
	}
	public void setPageNum(int pageNum) {
		this.pageNum = pageNum;
	}
	public int getPageSize() {
		return pageSize;
	}
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}
	public List<Map<String, Object>> getParams() {
		return params;
	}
	public void setParams(List<Map<String, Object>> params) {
		this.params = params;
	}
	public Object getParam(String key) {
		if(getParams().isEmpty()){
			return null;
		}else{
			for (Map<String, Object> param: getParams()) {
				if(param.containsValue(key) || (param.containsKey("name") && key.equals(param.get("name")))){
					return param.get("value");
				}
			}
			return null;
		}
	}
	
}
